package com.xbao.dao;

import com.xbao.model.PeriodRuleItem;
import com.xbao.model.PeriodRuleItemExample;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
@Mapper
public interface PeriodRuleItemMapper {
    @SelectProvider(type=PeriodRuleItemSqlProvider.class, method="countByExample")
    int countByExample(PeriodRuleItemExample example);

    @DeleteProvider(type=PeriodRuleItemSqlProvider.class, method="deleteByExample")
    int deleteByExample(PeriodRuleItemExample example);

    @Delete({
        "delete from period_rule_item",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into period_rule_item (id, ruletype, ",
        "starttime, endtime, ",
        "no, ruleid, cid, ",
        "hour, minute, subid, ",
        "orgid, durationtime)",
        "values (#{id,jdbcType=BIGINT}, #{ruletype,jdbcType=INTEGER}, ",
        "#{starttime,jdbcType=VARCHAR}, #{endtime,jdbcType=VARCHAR}, ",
        "#{no,jdbcType=INTEGER}, #{ruleid,jdbcType=BIGINT}, #{cid,jdbcType=BIGINT}, ",
        "#{hour,jdbcType=INTEGER}, #{minute,jdbcType=INTEGER}, #{subid,jdbcType=BIGINT}, ",
        "#{orgid,jdbcType=BIGINT}, #{durationtime,jdbcType=INTEGER})"
    })
    int insert(PeriodRuleItem record);

    @InsertProvider(type=PeriodRuleItemSqlProvider.class, method="insertSelective")
    int insertSelective(PeriodRuleItem record);

    @SelectProvider(type=PeriodRuleItemSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="ruletype", property="ruletype", jdbcType=JdbcType.INTEGER),
        @Result(column="starttime", property="starttime", jdbcType=JdbcType.VARCHAR),
        @Result(column="endtime", property="endtime", jdbcType=JdbcType.VARCHAR),
        @Result(column="no", property="no", jdbcType=JdbcType.INTEGER),
        @Result(column="ruleid", property="ruleid", jdbcType=JdbcType.BIGINT),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="hour", property="hour", jdbcType=JdbcType.INTEGER),
        @Result(column="minute", property="minute", jdbcType=JdbcType.INTEGER),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT),
        @Result(column="durationtime", property="durationtime", jdbcType=JdbcType.INTEGER)
    })
    List<PeriodRuleItem> selectByExample(PeriodRuleItemExample example);

    @Select({
        "select",
        "id, ruletype, starttime, endtime, no, ruleid, cid, hour, minute, subid, orgid, ",
        "durationtime",
        "from period_rule_item",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="ruletype", property="ruletype", jdbcType=JdbcType.INTEGER),
        @Result(column="starttime", property="starttime", jdbcType=JdbcType.VARCHAR),
        @Result(column="endtime", property="endtime", jdbcType=JdbcType.VARCHAR),
        @Result(column="no", property="no", jdbcType=JdbcType.INTEGER),
        @Result(column="ruleid", property="ruleid", jdbcType=JdbcType.BIGINT),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="hour", property="hour", jdbcType=JdbcType.INTEGER),
        @Result(column="minute", property="minute", jdbcType=JdbcType.INTEGER),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT),
        @Result(column="durationtime", property="durationtime", jdbcType=JdbcType.INTEGER)
    })
    PeriodRuleItem selectByPrimaryKey(Long id);

    @UpdateProvider(type=PeriodRuleItemSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") PeriodRuleItem record, @Param("example") PeriodRuleItemExample example);

    @UpdateProvider(type=PeriodRuleItemSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") PeriodRuleItem record, @Param("example") PeriodRuleItemExample example);

    @UpdateProvider(type=PeriodRuleItemSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(PeriodRuleItem record);

    @Update({
        "update period_rule_item",
        "set ruletype = #{ruletype,jdbcType=INTEGER},",
          "starttime = #{starttime,jdbcType=VARCHAR},",
          "endtime = #{endtime,jdbcType=VARCHAR},",
          "no = #{no,jdbcType=INTEGER},",
          "ruleid = #{ruleid,jdbcType=BIGINT},",
          "cid = #{cid,jdbcType=BIGINT},",
          "hour = #{hour,jdbcType=INTEGER},",
          "minute = #{minute,jdbcType=INTEGER},",
          "subid = #{subid,jdbcType=BIGINT},",
          "orgid = #{orgid,jdbcType=BIGINT},",
          "durationtime = #{durationtime,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(PeriodRuleItem record);
}